package br.infotec.musicaunb.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.search.annotations.DocumentId;
import org.springframework.data.jpa.domain.AbstractPersistable;
/**
 * entidade representando uma permissao
 * @author eduardo
 *
 */
@Entity
@Table(name="permissao")
public class Permissao extends AbstractPersistable<Integer> implements AbstraticPojo {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -1218860939239217777L;
	private String permissao;
	private List<Login> logins;
	
	
	@Override
	@DocumentId
	@GeneratedValue
	@Column(name="id_permissao")
	public Integer getId() {
		return super.getId();
	}
	public void setPermissao(String permissao) {
		this.permissao = permissao;
	}
	public String getPermissao() {
		return permissao;
	}
	
	@ManyToMany
	@JoinTable(name = "login_has_permissao", joinColumns = { @JoinColumn(name = "id_permissao") }, inverseJoinColumns = { @JoinColumn(name = "id_login") })
	public List<Login> getLogins() {
		return logins;
	}
	public void setLogins(List<Login> logins) {
		this.logins = logins;
	}	
}
